package day09_charset_io.com.itheima.d2_byte_stream;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Demo1_FileInputStream {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream(new File("d:/a.txt"));
        int b1 = fis.read();
        System.out.println("(char)b1 = " + (char) b1);

        int b2 = fis.read();
        System.out.println("(char)b2 = " + (char) b2);

        fis.close();
        FileInputStream fis2 = new FileInputStream(new File("d:/a.txt"));
        int b ;
        while ((b = fis2.read()) != -1){
            System.out.println("( char)b = " + (char) b);
        }
        fis2.close();
    }
}
